package com.cskaoyan.dbutils;

import com.cskaoyan.others.DruidUtils;
import com.cskaoyan.vo.Account;
import com.cskaoyan.vo.AccountVO;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * 创建日期: 2021/11/25 16:36
 *
 * @author ciggar
 */
public class DBUtilsDemo4Student {

    // select id,name from student

    public static void main(String[] args) throws SQLException {

        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        List<AccountVO> accountVOList = queryRunner.query("select id,name from account",new BeanListHandler<>(AccountVO.class));

        System.out.println(accountVOList);
    }

}
